#!/bin/sh
status=$(mv $* 2>&1 | grep "is not a directory" | wc -l)
dir=$(echo "$*" | awk '{print $NF}')
#echo $(($status))
#echo $dir
if [ $((status)) -eq 1 ]; then
    echo "create non-existing directory $dir?"
    read -r ANSWER
    if echo "$ANSWER" | grep -iq "^y"; then
        mkdir "$dir"
        mv $*
        echo "mv $*"
    else
        echo "aborting"
    fi
fi
